|
1
|
|
|
var xmlHttp; |
|
2
|
|
|
|
|
3
|
|
|
function checkConsent() |
|
4
|
|
|
{ |
|
5
|
|
|
var show_spid = this.id.charAt(this.id.length - 1); |
|
6
|
|
|
var checkbox = document.getElementById("checkbox_" + show_spid); |
|
7
|
|
|
|
|
8
|
|
|
xmlHttp = GetXmlHttpObject() |
|
9
|
|
|
if (xmlHttp === null) { |
|
10
|
|
|
alert("Browser does not support HTTP Request") |
|
|
|
|
|
|
11
|
|
|
return |
|
12
|
|
|
} |
|
13
|
|
|
|
|
14
|
|
|
var url = "consentAdmin.php" |
|
15
|
|
|
url = url + "?cv=" + checkbox.value |
|
16
|
|
|
url = url + "&action=" + checkbox.checked |
|
17
|
|
|
url = url + "&sid=" + Math.random() |
|
18
|
|
|
|
|
19
|
|
|
xmlHttp.onreadystatechange = function () { |
|
20
|
|
|
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") { |
|
21
|
|
|
document.getElementById("consentText_" + show_spid).innerHTML = xmlHttp.responseText; |
|
22
|
|
|
} |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
xmlHttp.open("GET", url, true) |
|
26
|
|
|
xmlHttp.send(null) |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
// This function creates an XMLHttpRequest |
|
30
|
|
|
function GetXmlHttpObject() |
|
31
|
|
|
{ |
|
32
|
|
|
var xmlHttp = null; |
|
|
|
|
|
|
33
|
|
|
try { |
|
34
|
|
|
// Firefox, Opera 8.0+, Safari |
|
35
|
|
|
xmlHttp = new XMLHttpRequest(); |
|
36
|
|
|
} catch (e) { |
|
37
|
|
|
//Internet Explorer |
|
38
|
|
|
try { |
|
39
|
|
|
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); |
|
|
|
|
|
|
40
|
|
|
} catch (e) { |
|
41
|
|
|
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
return xmlHttp; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
function toggleShowAttributes() |
|
48
|
|
|
{ |
|
49
|
|
|
var show_spid = this.id.charAt(this.id.length - 1); |
|
50
|
|
|
|
|
51
|
|
|
var disp = document.getElementById('attributes_' + show_spid); |
|
52
|
|
|
var showing = document.getElementById('showing_' + show_spid); |
|
53
|
|
|
var hiding = document.getElementById('hiding_' + show_spid); |
|
54
|
|
|
|
|
55
|
|
|
disp.style.display = (disp.style.display == 'none' ? 'block' : 'none'); |
|
56
|
|
|
showing.style.display = (disp.style.display == 'none' ? 'inline' : 'none'); |
|
57
|
|
|
hiding.style.display = (disp.style.display == 'none' ? 'none' : 'inline'); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
document.addEventListener( |
|
61
|
|
|
'DOMContentLoaded', |
|
62
|
|
|
function () { |
|
63
|
|
|
var show_hide = document.getElementsByClassName("show_hide"); |
|
64
|
|
|
for (var i = 0; i < show_hide.length; i++) { |
|
65
|
|
|
show_hide[i].addEventListener( |
|
66
|
|
|
'click', |
|
67
|
|
|
toggleShowAttributes |
|
68
|
|
|
); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
var checkbox = document.getElementsByClassName("checkbox"); |
|
72
|
|
|
for (var j = 0; j < checkbox.length; j++) { |
|
73
|
|
|
checkbox[j].addEventListener( |
|
74
|
|
|
'click', |
|
75
|
|
|
checkConsent |
|
76
|
|
|
); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
); |
|
80
|
|
|
|